
%Declare the symbolic variables (syms)
syms OmegagVal shkaVal lambdaprimeVal lambdaVal OmegagprimeVal 

f= Omegag*exp(OmegagVal)- yg*shkaVal+b/(Lambdastar*exp(lambdaVal)) ...
-(1-delta)*bet*Lambdastar*exp(lambdaprimeVal)/(Lambdastar*exp(lambdaVal))*(Omegag*exp(OmegagprimeVal));

%Take symbolic derivatives
dd1 = diff(f,OmegagVal);
dd2 = diff(f,shkaVal);
dd3 = diff(f,lambdaprimeVal);
dd4 = diff(f,lambdaVal);
dd5 = diff(f,OmegagprimeVal);

%Evaluates symbolic derivatives

OmegagVal=0;       %loglin
shkaVal=s;         %linearize
lambdaprimeVal=0;  %lin
lambdaVal=0;       %loglin
OmegagprimeVal=0;  %loglin


D1=subs(dd1);
D2=subs(dd2);
D3=subs(dd3);
D4=subs(dd4);
D5=subs(dd5);

% Transform symbolic into numbers (with double precision)
d1=double(D1);
d2=double(D2);
d3=double(D3);
d4=double(D4);
d5=double(D5);

ACont(4,OmegagLog)   = d1;
ACont(4,shkaLog)     = d2;
ALead(4,LambdaLog)   = d3;
ACont(4,LambdaLog)   = d4;
ALead(4,OmegagLog)   = d5; 
